/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util.ejb;

import entities.tools.Form;
import entities.users.AdminUser;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Marek
 */
@Local
public interface AdminUserBeanInterface {

    /**
     * Method creates new AdminUser instance
     *
     * @return new AdminUser instance
     */
    AdminUser createAdminUser();

    /**
     * Method deletes specified by detachedFormOnwer entity
     *
     * @param detachedAdminUser
     * @return true if operation succeeded, false - if not
     */
    boolean deleteAdminUser(AdminUser detachedAdminUser);

    /**
     * (Dangerous) Method is bypasses security policy. Normally AdminUser cannot
     * be deleted, when he had filled some forms before. Method is performing
     * delete operation on all instances of FilledForm entity related to the
     * Form Owner, specified by pram, and than it deletes also that AdminUser
     * entity, specified by param.
     *
     * @param detachedAdminUser
     * @return true - if operation succeeded false - otherwise
     */
    //TODO: Method need to be tested, if it works correctly
    boolean forcedDeleteAdminUser(AdminUser detachedAdminUser);
    //TODO: register the existing form, as a property of the existing form owner
    //TODO: remove the existing form, from the existing form owner, property list
    //TODO: register the existing form admin, as a connected to the form owner
    //TODO: remove the existing form admin, from the form owner connections with form admins list

    /**
     * Method find in the detabase entity specified by id parameter, and returns
     * this entity
     *
     * @param id
     * @return founded AdminUser
     */
    AdminUser getAdminUser(Long id);

    /**
     * Method returns all AdminUser entities from the database
     *
     * @return all AdminUser from the database
     */
    List<AdminUser> getAdminUsers();
    List<AdminUser> getAdminUsers(String orderBy,String kierunek);
    List<AdminUser> getAdminUsers(String orderBy,String kierunek,AdminUser adminUser);
    //updates the existing form owner
    /**
     * Method updates in the database, specified by detachedAdminUser entity
     *
     * @param detachedAdminUser
     * @return true if operation succeeded, false - if not
     */
    boolean updateAdminUser(AdminUser detachedAdminUser);
    
}
